﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>demo 1 : server_version</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>

<body>
<P><A href="http://www.kitebird.com/articles/pydbapi.html#TOC_1"><FONT 
face=Courier>http://www.kitebird.com/articles/pydbapi.html#TOC_1</FONT></A><BR><FONT 
face=Courier># server_version.py - retrieve and display database server 
version<BR><BR>import MySQLdb<BR><BR>conn = MySQLdb.connect (host = 
"localhost",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
user = 
"testuser",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
passwd = 
"testpass",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
db = "test")<BR>cursor = conn.cursor ()<BR>cursor.execute ("SELECT 
VERSION()")<BR>row = cursor.fetchone ()<BR>print "server version:", 
row[0]<BR>cursor.close ()<BR>conn.close ()</FONT></P>
<P><FONT 
face=Courier>D:\PhucPython\Python2MySQL\</FONT><FONT 
face=Courier><STRONG>Python2MySQL_demo1_server_version.py</STRONG></FONT></P></body>
</html>
